<?php

namespace app\common\model\repertory;

use app\common\model\BaseModel;

/**
 * 账单
 */
class Bill extends BaseModel
{
    protected $name = 'repertory_bill';
    protected $pk = 'id';

    public static function detail($id)
    {
        return self::with(['sets', 'details'])->find($id);
    }

    public function sets()
    {
        return $this->hasOne(BillSet::class, 'bill_id', 'id');
    }

    public function details()
    {
        return $this->hasMany(BillDetail::class, 'bill_id', 'id');
    }
}
